<!--
 * @Author: xuwejie 1529315455@qq.com
 * @Date: 2023-08-26 15:32:36
 * @LastEditors: xuwejie 1529315455@qq.com
 * @LastEditTime: 2023-11-04 10:03:00
 * @FilePath: \school-shop-vue\pages\account\treaty.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <view class="treaty">
    <!-- #ifndef MP-WEIXIN -->
    <my-navbar
      leftText=""
      :title="title"
      :height="100"
      :background="'#ffffff'"
      @leftClick="leftClick"
    ></my-navbar>
    <!-- #endif -->
    <view class="content">
      <u-parse :html="doc"></u-parse>
    </view>
  </view>
</template>

<script>
import { $https } from "@/static/js/request.js";
const app = getApp().globalData;
// const {navBar,} = app;
export default {
  data() {
    return {
      type: "5", //注册协议	1公告，2关于我们，3服务条款，4售后规则，5注册协议
      title: "注册协议",
      doc: "",
      // navBar: navBar
    };
  },
  onReady() {
    // getApp().setTitle()
  },
  onLoad(options) {
    if (options.type) {
      this.type = options.type;
      switch (this.type) {
        case "1": {
          this.title = "关于我们";
          break;
        }
        case "2": {
          this.title = "服务条款";
          break;
        }
        case "3": {
          this.title = "售后规则";
          break;
        }
        case "4": {
          this.title = "注册协议";
          break;
        }
      }
      uni.setNavigationBarTitle({
        title: this.title,
      });
    }
    this.getData(this.type);
  },
  methods: {
    getData(type) {
      $https(
        "GETN",
        "getDocument",
        { type: type },
        (res) => {
          if (res.data.errcode == 0) {
            this.doc = res.data.data.content;
          } else {
            this.$u.toast(res.data.errmsg);
          }
        },
        true
      );
    },
    leftClick() {
      // #ifdef H5
      uni.hideKeyboard();
      window.history.back(-1);
      // #endif
      // #ifndef H5
      uni.navigateBack({
        delta: 1,
      });
      // #endif
    },
  },
};
</script>

<style>
.treaty .content {
  margin: 20rpx 30rpx;
  padding: 30rpx 30rpx 30rpx 30rpx;

  background: #ffffff;
  border-radius: 20rpx;
  font-size: 30rpx;
  color: rgba(0, 0, 0, .95);
}

.treaty .content .first {
  font-size: 30rpx;
  text-indent: 30rpx;
}

</style>
